package com.interview.ujiuye8;
interface ICourse{
    void record();//录制视频的方法
}
class JavaCourse implements ICourse{
    @Override
    public void record() {
        System.out.println("录制java视频课程");
    }
}
class PythonCourse implements ICourse{
    @Override
    public void record() {
        System.out.println("录制python视频课程");
    }
}
class CourseFactory{
    public ICourse createCourse(String name){
        if ("java".equals(name)){
            return new JavaCourse();
        }else if("python".equals(name)){
            return new PythonCourse();
        }else{
            return null;
        }
    }
}

public class SimpleFactoryDemo {
    public static void main(String[] args) {
        CourseFactory factory = new CourseFactory();
        ICourse java = factory.createCourse("java");
        java.record();
        ICourse python = factory.createCourse("python");
        python.record();
    }
}
